package com.tan.dao;

import com.tan.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface UserMapper {
/**
* 注解查询
* */
    @Select("select * from user")
    List<User> getUsers();
    /**
     * 多个参数用@Param注解标签
     * */
    //查询
    @Select("select * from user where id=#{id}")
    User getUserById(@Param("id") int id);
    //新增
    @Insert("insert into user(id,name,pwd) values(#{id},#{name},#{password})")
    int addUser(User user);

    //修改
    @Update("update user set name=#{name},pwd=#{password} where id=#{id}")
    int updateUser(User user);

    //删除
    @Delete("delete from user where id=#{id}")
    int deleteUser(@Param("id") int id);
}
